<include file="Public:header"/>		
<div id="content">
	<div id="content-header">
		<h1>发布新版本</h1>
		<div class="btn-group">
			<a href="{:U('Admin/Version/versionList')}" class="btn btn-large" title="版本列表"><i class="fa fa-tasks"></i></a>
		</div>
	</div>
	<div id="breadcrumb">
		<a href="index.html" title="回到首页" class="tip-bottom"><i class="fa fa-home"></i> 首页</a>
		<a href="#">发布内容</a>
		<a href="#" class="current">发布新版本</a>
	</div>
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-12 center" style="text-align: center;">					
				<ul class="quick-actions">
					<li>
						<a href="#">
							<i class="icon-cal"></i>
							已运行：634 天
						</a>
					</li>
					<li>
						<a href="#">
							<i class="icon-tag"></i>
							共发布：47个版本
						</a>
					</li>
					<li>
						<a href="#">
							<i class="icon-book"></i>
							使用手册
						</a>
					</li>
					<li>
						<a href="#">
							<i class="icon-survey"></i>
							写文章
						</a>
					</li>
					<li>
						<a href="#">
							<i class="icon-download"></i>
							下载统计
						</a>
					</li>
					<li>
						<a href="#">
							<i class="icon-graph"></i>
							站长统计
						</a>
					</li>
				</ul>
			</div>	
		</div>
		<div class="row">
			<div class="col-xs-12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon">
							<i class="fa fa-volume-up"></i>									
						</span>
						<h5>发布新版本</h5>
					</div>
					<div class="widget-content nopadding">
						<form method="get" class="form-horizontal">
							
							<div class="form-group">
                                <label class="col-sm-3 col-md-3 col-lg-1 control-label">当前版本号</label>
                                <div class=" col-sm-9 col-md-9 col-lg-10">
                                	<div class="input-group input-group-sm">
										<span class="input-group-addon"><i class="fa fa-laptop"></i></span>
										<empty name="now[v_id]">
											<input type="text" value="{$Think.config.NAME} V 2.0" class="form-control input-sm"  readonly/>
										<else />
											<input type="text" value="{$Think.config.NAME} V {$now.v_version}" class="form-control input-sm"  readonly/>
										</empty>
                                    </div>
                                </div>
                            </div>
							
							<div class="form-group">
                                <label class="col-sm-3 col-md-3 col-lg-1 control-label">版本号</label>
                                <div class=" col-sm-9 col-md-9 col-lg-10">
                                	<div class="input-group input-group-sm">
										<span class="input-group-addon"><i class="fa fa-laptop"></i></span>
                                    	<input type="text" class="form-control input-sm" placeholder="V 2.0.x" id="version"/>
                                    </div>
                                </div>
                            </div>
							
							<div class="form-group">
								<label class="col-sm-3 col-md-3 col-lg-1 control-label">修复内容</label>
								<div class="col-sm-9 col-md-9 col-lg-10">
									<textarea rows="5" class="form-control" id="remark"></textarea>
								</div>
							</div>
							
							<div class="form-group">
                                <label class="col-sm-3 col-md-3 col-lg-1 control-label">发表时间</label>
                                <div class=" col-sm-9 col-md-9 col-lg-10">
                                	<div class="row">
                                		<div class="col-md-6">
                                    		<input type="text" value="{:date("Y-m-d H:i:s",time())}" class="form-control input-sm" id="time" />
                                    	</div>
                                    </div>
                                </div>
                            </div>
                            
							<div class="form-group">
                                <label class="col-sm-3 col-md-3 col-lg-1 control-label">发表人</label>
                                <div class=" col-sm-9 col-md-9 col-lg-10">
                                	<div class="input-group input-group-sm">
										<span class="input-group-addon"><i class="fa fa-user"></i></span>
                                    	<input type="text" value="{$Think.session.uname}" class="form-control input-sm" id="root" />
                                    </div>
                                </div>
                            </div>
                            
                            <div class="form-group">
								<label class="col-sm-3 col-md-3 col-lg-1 control-label">是否显示</label>
								<div class="col-sm-9 col-md-9 col-lg-10">
									<label><input type="radio" name="show" value="0" /> 不显示</label>
									<label><input type="radio" name="show" value="1" checked /> 显示</label>
								</div>
							</div>
							
							<div class="form-group">
                                <label class="col-sm-3 col-md-3 col-lg-1 control-label">发表IP</label>
                                <div class=" col-sm-9 col-md-9 col-lg-10">
                                	<div class="input-group input-group-sm">
										<span class="input-group-addon"><i class="fa fa-user"></i></span>
                                    	<input type="text" value="{:get_client_ip()}" class="form-control input-sm" id="ip" />
                                    </div>
                                </div>
                            </div>
                            
							
							<div class="form-actions">
								<button type="button" class="btn btn-success btn-sm" id="addv">存入数据库</button>&nbsp;&nbsp;  
								<button type="button" class="btn btn-danger btn-sm">取消</button>
							</div>
						</form>
						
					</div>
				</div>						
			</div>
		</div>
	</div>
</div>
<include file="Public:footer"/>
<script>
	$(document).ready(function(){
		$('input[type=checkbox],input[type=radio]').iCheck({
	    	checkboxClass: 'icheckbox_flat-blue',
	    	radioClass: 'iradio_flat-blue'
		});
	    $('.spinner').spinner();
	    $('#addv').click(function(){
	    	var version = $('#version').val();
	    	var remark = $('#remark').val();
    		var time = $('#time').val();
    		var show = $('input[name="show"]:checked').val();
    		var root = $('#root').val();
    		var ip = $('#ip').val();
    		if(!version){
    			err("版本不能为空!");
    			return false;
    		}else if(!time){
    			err("请勿删除时间!");
    			return false;
    		}else if(!remark){
    			err("请输入描述!");
    			return false;
    		}else if(!root){
    			err("请勿删除作者!");
    			return false;
    		}else if(!ip){
    			err("IP不能为空!");
    			return false;
    		}
    		$("#addv").attr("disabled",true);
    		$.ajax({
    			type:"post",
    			url:"/Admin/Version/versionAdd",
    			async:true,
    			data:{"v_version":version,"v_remark":remark,"v_ip":ip,"v_time":time,"v_view":show,"v_author":root},
				success:function(data){
					if(data.error==0){
						succ("新增版本完成!",data.msg,"/Admin/Version/versionList");
					}else{
						err(data.msg);
						$("#addv").removeAttr('disabled');
					}
				},
				eerror:function(data){
					err("网络错误!");
					$("#addv").removeAttr('disabled');
				}
    		});
    	});
	});
</script>
</body>
</html>
